﻿using System.Collections.Generic;
namespace Odyssey.Consul.Features
{
    public class ConsulHeaders
    {
        public const string Token = "X-Consul-Token";


        public static Dictionary<string, string> BuildConsulToken(string token)
        {
            if (!string.IsNullOrWhiteSpace(token))
            {
                return new Dictionary<string, string>() {
                    { Token, token }
                };
            }
            return null;
        }

        public static Dictionary<string, string> BuildConsulToken(IConsulConfiguration consulConfiguration)
        {
            if (consulConfiguration.EnableAcl)
            {
                return new Dictionary<string, string>() {
                    { Token, consulConfiguration.SecretID }
                };
            }
            return null;
        }
    }
}
